#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>

#include "test_helpers.h"

struct test_case {
    int c;
    int isalnum;
    int isalpha;
    int isascii;
    int isblank;
    int iscntrl;
    int isdigit;
    int isgraph;
    int islower;
    int isprint;
    int ispunct;
    int isspace;
    int isupper;
    int isxdigit;
    int toascii;
    int tolower;
    int toupper;
} test_cases[] = {
    //      a  a  a  b  c  d  g  l  p  p  s  u  x     t     t     t
    //      l  l  s  l  n  i  r  o  r  u  p  p  d     o     o     o
    //      n  p  c  a  t  g  a  w  i  n  a  p  i     a     l     u
    //      u  h  i  n  r  i  p  e  n  c  c  e  g     s     o     p
    //      m  a  i  k  l  t  h  r  t  t  e  r  i     c     w     p
    { 0x00, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x00, 0x00 },
    { 0x01, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0x01, 0x01 },
    { 0x02, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x02, 0x02, 0x02 },
    { 0x03, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x03, 0x03, 0x03 },
    { 0x04, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x04, 0x04, 0x04 },
    { 0x05, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x05, 0x05, 0x05 },
    { 0x06, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x06, 0x06, 0x06 },
    { 0x07, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x07, 0x07, 0x07 },
    { 0x08, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x08, 0x08 },
    { 0x09, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0x09, 0x09, 0x09 },
    { 0x0A, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0x0A, 0x0A, 0x0A },
    { 0x0B, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0x0B, 0x0B, 0x0B },
    { 0x0C, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0x0C, 0x0C, 0x0C },
    { 0x0D, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0x0D, 0x0D, 0x0D },
    { 0x0E, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x0E, 0x0E, 0x0E },
    { 0x0F, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x0F, 0x0F, 0x0F },
    { 0x10, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0x10, 0x10 },
    { 0x11, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x11, 0x11, 0x11 },
    { 0x12, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x12, 0x12, 0x12 },
    { 0x13, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x13, 0x13, 0x13 },
    { 0x14, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x14, 0x14, 0x14 },
    { 0x15, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x15, 0x15, 0x15 },
    { 0x16, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x16, 0x16, 0x16 },
    { 0x17, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x17, 0x17, 0x17 },
    { 0x18, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x18, 0x18, 0x18 },
    { 0x19, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x19, 0x19, 0x19 },
    { 0x1A, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x1A, 0x1A, 0x1A },
    { 0x1B, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x1B, 0x1B, 0x1B },
    { 0x1C, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x1C, 0x1C, 0x1C },
    { 0x1D, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x1D, 0x1D, 0x1D },
    { 0x1E, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x1E, 0x1E, 0x1E },
    { 0x1F, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x1F, 0x1F, 0x1F },
    {  ' ', 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0,  ' ',  ' ',  ' ' },
    {  '!', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '!',  '!',  '!' },
    {  '"', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '"',  '"',  '"' },
    {  '#', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '#',  '#',  '#' },
    {  '$', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '$',  '$',  '$' },
    {  '%', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '%',  '%',  '%' },
    {  '&', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '&',  '&',  '&' },
    { '\'', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, '\'', '\'', '\'' },
    {  '(', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '(',  '(',  '(' },
    {  ')', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  ')',  ')',  ')' },
    {  '*', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '*',  '*',  '*' },
    {  '+', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '+',  '+',  '+' },
    {  ',', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  ',',  ',',  ',' },
    {  '-', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '-',  '-',  '-' },
    {  '.', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '.',  '.',  '.' },
    {  '/', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '/',  '/',  '/' },
    {  '0', 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,  '0',  '0',  '0' },
    {  '1', 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,  '1',  '1',  '1' },
    {  '2', 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,  '2',  '2',  '2' },
    {  '3', 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,  '3',  '3',  '3' },
    {  '4', 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,  '4',  '4',  '4' },
    {  '5', 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,  '5',  '5',  '5' },
    {  '6', 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,  '6',  '6',  '6' },
    {  '7', 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,  '7',  '7',  '7' },
    {  '8', 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,  '8',  '8',  '8' },
    {  '9', 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1,  '9',  '9',  '9' },
    {  ':', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  ':',  ':',  ':' },
    {  ';', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  ';',  ';',  ';' },
    {  '<', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '<',  '<',  '<' },
    {  '=', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '=',  '=',  '=' },
    {  '>', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '>',  '>',  '>' },
    {  '?', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '?',  '?',  '?' },
    {  '@', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '@',  '@',  '@' },
    {  'A', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1,  'A',  'a',  'A' },
    {  'B', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1,  'B',  'b',  'B' },
    {  'C', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1,  'C',  'c',  'C' },
    {  'D', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1,  'D',  'd',  'D' },
    {  'E', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1,  'E',  'e',  'E' },
    {  'F', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1,  'F',  'f',  'F' },
    {  'G', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'G',  'g',  'G' },
    {  'H', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'H',  'h',  'H' },
    {  'I', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'I',  'i',  'I' },
    {  'J', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'J',  'j',  'J' },
    {  'K', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'K',  'k',  'K' },
    {  'L', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'L',  'l',  'L' },
    {  'M', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'M',  'm',  'M' },
    {  'N', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'N',  'n',  'N' },
    {  'O', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'O',  'o',  'O' },
    {  'P', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'P',  'p',  'P' },
    {  'Q', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'Q',  'q',  'Q' },
    {  'R', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'R',  'r',  'R' },
    {  'S', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'S',  's',  'S' },
    {  'T', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'T',  't',  'T' },
    {  'U', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'U',  'u',  'U' },
    {  'V', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'V',  'v',  'V' },
    {  'W', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'W',  'w',  'W' },
    {  'X', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'X',  'x',  'X' },
    {  'Y', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'Y',  'y',  'Y' },
    {  'Z', 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0,  'Z',  'z',  'Z' },
    {  '[', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '[',  '[',  '[' },
    { '\\', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, '\\', '\\', '\\' },
    {  ']', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  ']',  ']',  ']' },
    {  '^', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '^',  '^',  '^' },
    {  '_', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '_',  '_',  '_' },
    {  '`', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '`',  '`',  '`' },
    {  'a', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,  'a',  'a',  'A' },
    {  'b', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,  'b',  'b',  'B' },
    {  'c', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,  'c',  'c',  'C' },
    {  'd', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,  'd',  'd',  'D' },
    {  'e', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,  'e',  'e',  'E' },
    {  'f', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,  'f',  'f',  'F' },
    {  'g', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'g',  'g',  'G' },
    {  'h', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'h',  'h',  'H' },
    {  'i', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'i',  'i',  'I' },
    {  'j', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'j',  'j',  'J' },
    {  'k', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'k',  'k',  'K' },
    {  'l', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'l',  'l',  'L' },
    {  'm', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'm',  'm',  'M' },
    {  'n', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'n',  'n',  'N' },
    {  'o', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'o',  'o',  'O' },
    {  'p', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'p',  'p',  'P' },
    {  'q', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'q',  'q',  'Q' },
    {  'r', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'r',  'r',  'R' },
    {  's', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  's',  's',  'S' },
    {  't', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  't',  't',  'T' },
    {  'u', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'u',  'u',  'U' },
    {  'v', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'v',  'v',  'V' },
    {  'w', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'w',  'w',  'W' },
    {  'x', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'x',  'x',  'X' },
    {  'y', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'y',  'y',  'Y' },
    {  'z', 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,  'z',  'z',  'Z' },
    {  '{', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '{',  '{',  '{' },
    {  '|', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '|',  '|',  '|' },
    {  '}', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '}',  '}',  '}' },
    {  '~', 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,  '~',  '~',  '~' },
    { 0x7F, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x7F, 0x7F, 0x7F },
    { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x80, 0x80 },
    { 0x81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0x81, 0x81 },
    { 0x82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02, 0x82, 0x82 },
    { 0x83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x03, 0x83, 0x83 },
    { 0x84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x04, 0x84, 0x84 },
    { 0x85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x05, 0x85, 0x85 },
    { 0x86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x06, 0x86, 0x86 },
    { 0x87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x07, 0x87, 0x87 },
    { 0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x88, 0x88 },
    { 0x89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x09, 0x89, 0x89 },
    { 0x8A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0A, 0x8A, 0x8A },
    { 0x8B, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0B, 0x8B, 0x8B },
    { 0x8C, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0C, 0x8C, 0x8C },
    { 0x8D, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0D, 0x8D, 0x8D },
    { 0x8E, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0E, 0x8E, 0x8E },
    { 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0F, 0x8F, 0x8F },
    { 0x90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0x90, 0x90 },
    { 0x91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x11, 0x91, 0x91 },
    { 0x92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x12, 0x92, 0x92 },
    { 0x93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x13, 0x93, 0x93 },
    { 0x94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x14, 0x94, 0x94 },
    { 0x95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x15, 0x95, 0x95 },
    { 0x96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x16, 0x96, 0x96 },
    { 0x97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x17, 0x97, 0x97 },
    { 0x98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x18, 0x98, 0x98 },
    { 0x99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x19, 0x99, 0x99 },
    { 0x9A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1A, 0x9A, 0x9A },
    { 0x9B, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1B, 0x9B, 0x9B },
    { 0x9C, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1C, 0x9C, 0x9C },
    { 0x9D, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1D, 0x9D, 0x9D },
    { 0x9E, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1E, 0x9E, 0x9E },
    { 0x9F, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1F, 0x9F, 0x9F },
    { 0xA0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  ' ', 0xA0, 0xA0 },
    { 0xA1, 0, 0, 0, 0, 0, 0, 0, 0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xE0, 0xE0 },
    { 0xE1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'a', 0xE1, 0xE1 },
    { 0xE2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'b', 0xE2, 0xE2 },
    { 0xE3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'c', 0xE3, 0xE3 },
    { 0xE4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'd', 0xE4, 0xE4 },
    { 0xE5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'e', 0xE5, 0xE5 },
    { 0xE6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'f', 0xE6, 0xE6 },
    { 0xE7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'g', 0xE7, 0xE7 },
    { 0xE8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'h', 0xE8, 0xE8 },
    { 0xE9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'i', 0xE9, 0xE9 },
    { 0xEA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'j', 0xEA, 0xEA },
    { 0xEB, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'k', 0xEB, 0xEB },
    { 0xEC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'l', 0xEC, 0xEC },
    { 0xED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'm', 0xED, 0xED },
    { 0xEE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'n', 0xEE, 0xEE },
    { 0xEF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'o', 0xEF, 0xEF },
    { 0xF0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'p', 0xF0, 0xF0 },
    { 0xF1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'q', 0xF1, 0xF1 },
    { 0xF2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'r', 0xF2, 0xF2 },
    { 0xF3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  's', 0xF3, 0xF3 },
    { 0xF4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  't', 0xF4, 0xF4 },
    { 0xF5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'u', 0xF5, 0xF5 },
    { 0xF6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'v', 0xF6, 0xF6 },
    { 0xF7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'w', 0xF7, 0xF7 },
    { 0xF8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'x', 0xF8, 0xF8 },
    { 0xF9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'y', 0xF9, 0xF9 },
    { 0xFA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  'z', 0xFA, 0xFA },
    { 0xFB, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  '{', 0xFB, 0xFB },
    { 0xFC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  '|', 0xFC, 0xFC },
    { 0xFD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  '}', 0xFD, 0xFD },
    { 0xFE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  '~', 0xFE, 0xFE },
    { 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7F, 0xFF, 0xFF },
    // SUSv2 states that these functions should also accept EOF.
    { EOF,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7F,  EOF,  EOF }
};

size_t num_test_cases = sizeof(test_cases) / sizeof(struct test_case);

#define CHECK_TEST(tc, fn, retval) \
    do { \
        if (fn(tc.c) != tc.fn) { \
            retval = EXIT_FAILURE; \
            printf("Unexpected result: " #fn "('%c') != %d // Char value: %d\n", tc.c, tc.fn, tc.c); \
        } \
    } while (0)

int main(void) {
    int retval = EXIT_SUCCESS;

    for(int i = 0; i < num_test_cases; ++i) {
        struct test_case tc = test_cases[i];
        CHECK_TEST(tc, isalnum, retval);
        CHECK_TEST(tc, isalpha, retval);
        CHECK_TEST(tc, isascii, retval);
        CHECK_TEST(tc, isblank, retval);
        CHECK_TEST(tc, iscntrl, retval);
        CHECK_TEST(tc, isdigit, retval);
        CHECK_TEST(tc, isgraph, retval);
        CHECK_TEST(tc, islower, retval);
        CHECK_TEST(tc, isprint, retval);
        CHECK_TEST(tc, ispunct, retval);
        CHECK_TEST(tc, isspace, retval);
        CHECK_TEST(tc, isupper, retval);
        CHECK_TEST(tc, isxdigit, retval);
        CHECK_TEST(tc, toascii, retval);
        CHECK_TEST(tc, tolower, retval);
        CHECK_TEST(tc, toupper, retval);
    }

    if (retval == EXIT_SUCCESS) {
        printf("Success: %d\n", retval);
    } else {
        printf("Failure: %d\n", retval);
    }

    return retval;
}
